package com.luntan.activity;

import java.util.ArrayList;
import java.util.List;

import com.luntan.adapter.ContentAdapter;
import com.luntan.adapter.ListItemContentAdapter;
import com.luntan.utils.Utils;
import com.luntan.view.R;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;

public class GoforumItemActivity extends Activity {

	public ListView listlistview;
	public EditText et_sendmessage;
	public Button btn_send;
	public List<String> list;
	private LinearLayout messageContain;
	private ListItemContentAdapter adapter;
	public ListItemContentAdapter listitemcontentadapter = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_gonforumitems);
		listlistview = (ListView) findViewById(R.id.listview);
		
		btn_send=(Button)findViewById(R.id.btn_send);
		et_sendmessage=(EditText)findViewById(R.id.et_sendmessage);
		list=new ArrayList<String>();

		adapter=new ListItemContentAdapter(GoforumItemActivity.this,list);
		listlistview.setAdapter(adapter);
		
		btn_send.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				list.add(et_sendmessage.getText().toString());	
				
				adapter.notifyDataSetChanged();
				et_sendmessage.setText("");				
				listlistview.setSelection(listlistview.getCount() - 1);
				
			}
		});
		
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}
	
}
